function [Initial_Sync_Preamble,Mini_Probes,Reinserted_Preamble_Modulated] = Preamble_Gen_SameSigns(Rate,Interleaver_L)

%*-------------------------------------  Preamble_Gen ----------------------------------------------%
%
% [Initial_Sync_Preamble,Mini_Probes,Reinserted_Preamble_Modulated] =
% Preamble_Gen(Rate,Interleaver_L)
%
% Initial_Sync_Preamble: the first 184 symbol in the preamble, also the conjugate of it can be
% repeated N times before the start of the packet for the AGC operation.
%
% Mini_Probes: the 71 mini probes for the hole 72 frames.(note they are the same for each 72 data frames)
%
% Reinserted_Preamble_Modulated: the start and the end for the 72 frames.
%*---------------------------------------------------------------------------------------------------*%
global Sync_Preamble Mini_Probe_Plus Mini_Probe_Minus LUT_S LUT_D
% the preamble values and LUT's

Rate_8PSK = 4800;
% Sync Preamble and Mini_Probes and Reiserted are modulated as 8PSK

Data_Rates = [3200 4800 6400 8000 9600];
Interleaver_Lengths = [1 3 9 18 36 72];
Rate_Index = find(Data_Rates==Rate);
Interleaver_Index = find(Interleaver_Lengths==Interleaver_L);

%*------------------------------ Initial_Sync_Preamble --------------------------------------------*%

Initial_Sync_Preamble = HF_Modulate(Sync_Preamble,Rate_8PSK);
%*---------------------------------------------------------------------------------------------------*%

%*----------------------------- Reinserted_Preamble_Modulated ---------------------------------*%

D0 = LUT_D(Rate_Index,Interleaver_Index,1);
D1 = LUT_D(Rate_Index,Interleaver_Index,2);
D2 = LUT_D(Rate_Index,Interleaver_Index,3);

D_Part = [2 ...
                   [mod([D0 D0 D0 D0 D0 D0 D0 D0 D0 D0 D0 D0 D0]+[0 4 0 4 0 0 4 4 0 0 0 0 0],8)] ...
                   [mod([D1 D1 D1 D1 D1 D1 D1 D1 D1 D1 D1 D1 D1]+[0 4 0 4 0 0 4 4 0 0 0 0 0],8)] ...
                   [mod([D2 D2 D2 D2 D2 D2 D2 D2 D2 D2 D2 D2 D2]+[0 4 0 4 0 0 4 4 0 0 0 0 0],8)] ...
                  6];
              
Reinserted_Preamble = [Mini_Probe_Plus  D_Part  Mini_Probe_Plus];         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Reinserted_Preamble_Modulated = HF_Modulate(Reinserted_Preamble,Rate_8PSK);
%*---------------------------------------------------------------------------------------------------*%

%*---------------------------------- Mini_Probes Modulated ---------------------------------------*%
% the miniprobes for the hole data frames (with the signs of it depend on the rate and interleaver sizes)
% but it need to be arranged as mentioned in the standard with data frames
% and reinsreted preambles (doing this in HF_Framming function)

Mini_Probe_Plus_Modulated =  HF_Modulate(Mini_Probe_Plus,Rate_8PSK);
Mini_Probe_Minus_Modulated =  HF_Modulate(Mini_Probe_Minus,Rate_8PSK);
Mini_Probe_Plus_Minus_Modulated = [Mini_Probe_Plus_Modulated;Mini_Probe_Minus_Modulated];

for index1 = 1:6 
    % the six mini probes that depend on the rate and interleaver size
    Mini_Probe_S0_S5(index1,:) = Mini_Probe_Plus_Minus_Modulated(LUT_S(Rate_Index,Interleaver_Index,index1)+1,:);%#ok
end

for index2 = 1:7 
    % the first seven minus probes of the first eight symbols that locates
    % the following probes (represent the rate and interleaver size)
    Mini_Probe_First_8(index2,:) = Mini_Probe_Minus_Modulated;%#ok
end
Mini_Probe_First_8(8,:) = Mini_Probe_Plus_Modulated;

Mini_Probe_Set1 = [Mini_Probe_Plus_Modulated;Mini_Probe_Plus_Modulated;Mini_Probe_Minus_Modulated];
Mini_Probe_Set2 = [Mini_Probe_Plus_Modulated;Mini_Probe_Minus_Modulated;Mini_Probe_Plus_Modulated];
Mini_Probe_Set3 = [Mini_Probe_Plus_Modulated;Mini_Probe_Minus_Modulated;Mini_Probe_Minus_Modulated];
Mini_Probe_Set4 = [Mini_Probe_Minus_Modulated;Mini_Probe_Plus_Modulated;Mini_Probe_Plus_Modulated];


Mini_Probes = [Mini_Probe_First_8; Mini_Probe_S0_S5; Mini_Probe_Set1; Mini_Probe_Plus_Modulated;
                         Mini_Probe_First_8; Mini_Probe_S0_S5; Mini_Probe_Set2; Mini_Probe_Plus_Modulated;
                         Mini_Probe_First_8; Mini_Probe_S0_S5; Mini_Probe_Set3; Mini_Probe_Plus_Modulated;
                         Mini_Probe_First_8; Mini_Probe_S0_S5; Mini_Probe_Set4];
                     
Mini_Probes = repmat(Mini_Probe_Plus_Modulated,71,1);        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%             
                     
%*---------------------------------------------------------------------------------------------------*%
